#ifndef NETWORKMANAGER_H
#define NETWORKMANAGER_H

#include <sys/epoll.h>
#include <netinet/in.h>
#include <unistd.h>
#include <fcntl.h>
#include <cstring>
#include "RequestHandler.h"
#include "wrap.h"
#include "thread-pool.h"

// 客户端请求结构体
struct ClientRequest
{
     int client_fd;
     char *buffer;  // 缓冲区
     size_t length; // 数据长度
     int epoll_fd;
};


class NetworkManager
{
private:
    void SetupSocket();  //用来设置套接字


public:  
    NetworkManager(int port);   //传入端口号进行管理
    ~NetworkManager() = default;
    void start();   //开始进行管理
    

private:
    int m_port;  
    int m_epollfd;
    int m_listenfd;
    char rbuff[BUFFER_LENGTH];
    char wbuff[BUFFER_LENGTH];
     
    RequestHandler m_requestHandler;  // 添加请求处理器
    thread_pool_t * m_threadPool;  //添加线程池指针
   
};

#endif